home *** CD-ROM | disk | FTP | other *** search
-
- ' The QuickBASIC Tutorial Series
-
- ' Part 1
- ' The QuickBASIC Editor
-
- ' Copyright 1986 Ford Software
-
- ' 4845 Willowbend Blvd
- ' Houston, TX 77035
- ' (713) 721-5205
- ' CompuServe ppn: 71355,470
-
- 'This Tutorial may not be copied or distributed in any form - printed, on disk
- 'or electronically - without the express written permission of Ford Software.
- ' Unlicensed distribution is a violation of copyright law
- ' and may be subject to civil and criminal prosecution.
-
- 'QuickBASIC is the registered trademark of the Microsoft Corporation.
- 'Ford Software is not associated in any way with the Microsoft Corporation.
-
- '(Make sure NumLock is off and press PgDn)
- 'page 2
- ' I N T R O D U C T I O N
-
- 'Congratulations! You have purchased one of the best programming environments
- 'this author has had the pleasure to have used. Oh sure, it has its quirks and
- 'design flaws - even bugs. But none of its shortcomings can seriously detract
- 'from its many advantages to the BASIC programmer. Please keep that in mind
- 'if we seem to be overly critical (even sarcastic) at times.
-
- 'QB2's documentation may seem imposing. That's because it is intended more as
- 'a reference book than as a tutorial for learning programming. Our tutorial
- 'will both guide you through the manual in a logical order and provide an
- 'interactive tutorial for immediate reinforcement of what you have read.
-
- 'If you should happen to accidentally erase some lines in one of the tutorial
- 'files, just reload the file. To do this, press Alt-F, L, Enter, and enter
- 'the name of the tutorial file shown at the top of this screen. You will be
- 'asked if you want to save the changes you made to this file. Of course you
- 'do not, but convincing QB2 is tough. Use the Tab key to highlight the NO
- 'box and press the space bar - DO NOT PRESS THE ENTER KEY.
-
- '(Press PgDn)
- 'page 3
- ' Contents
- ' page
- ' 4 The Editor's Screen
- ' 5 The Keyboard
- ' 6 ..Restoring a Changed Line
- ' 6 ..Cut and Paste
- ' 7 ..Copying
- ' 7 ..Deleting Whole Lines
- ' 8 The Menu
- ' 8 ..Edit
- ' 8 ..File
- ' 9 ..View
- ' 9 ..Search
- ' 10 ....Change
- ' 11 ..Run (Compiling and Running)
- ' 12 Review
- '
- ' There is no index. To search for a topic, press Ctrl-F and enter the word.
- '
- '
- '(Press PgDn)
- 'page 4
- ' The Editor's Screen
-
- 'If you have an EGA card and had it in the 43-line mode when you started QB2,
- 'you should be seeing 43 lines now. That's fine most of the time (though when
- 'you run a program, it will only use the top 25 lines of the screen), but this
- 'tutorial has been formatted for the 25-line mode, so return to DOS and change
- 'to that mode.
-
- 'Now, notice the right side of the screen frame. If you have a color monitor,
- 'the frame should be green with a black mark somewhere on it. The black mark
- 'indicates graphically where you are in the program code. Press Ctrl-PgUp to
- 'move to the top of the file, and you will see the mark at the top of the
- 'right frame. At the end of the file, the mark will be at the bottom. Right
- 'now it should be about 25% of the way down the side, indicating we are about
- '25% of the way through the file.
-
- 'The mark at the bottom of the screen shows you your position relative to the
- 'maximum line length of 255 characters. However, you should try to limit lines
- 'to 80 characters or less so that you don't accidentally miss seeing anything.
-
- '(Press PgDn)
- 'page 5
- ' The Keyboard
-
- 'The Editor's use of the keyboard really takes some getting used to. If you
- 'normally leave your NumLock key off, you won't have as much trouble as those
- 'who normally leave NumLock on and use the shift key when they want to move
- 'the cursor. You will need to leave it off for easy use of the cut and paste
- 'features of QB2.
-
- 'The status of the NumLock, CapsLock and ScrollLock keys are displayed on the
- 'right side of the bar at the top of the screen. (ScrollLock does nothing.)
-
- 'The next quirk of the editor is that it does not have an overstrike mode. In
- 'other words, you are in the "insert" mode all the time. This seems like a
- 'needless limitation and hopefully one that MS will fix in future versions.
-
- 'Using the cursor keys, move the cursor to right here --> .
- 'Press the Home key and move to the start of the line. Also try the End key
- 'and the Ctrl-Left and Ctrl-Right keys to move a word at a time. Ctrl-home
- 'moves the cursor to the top of the screen; Ctrl-End, to the bottom.
- 'Ctrl-PgUp moves to the start of the file and Ctrl-PgDn to the end.
- 'Ctrl-Up and Ctrl-Down scroll the screen a line at a time. (press PgDn)
- 'page 6 (Keyboard, continued)
-
- 'RESTORING A CHANGED LINE:
- 'With the cursor right here -->. hold Ctrl and press D to delete to the end of
- 'the line. Without moving the cursor, press the Ins key to restore the deleted
- 'text. Since QB2 doesn't have an overtype mode you will be using Ctrl-D a lot.
- 'Holding the Shift key down and pressing Esc would also restore the deleted
- 'text, but this key combination has an even more important feature.
-
- 'Put the cursor on this line. Type in some new characters and delete others.
- 'Then press Shift-Esc and the original line will be restored. You must press
- 'Shift-Esc before you move the cursor from the line you want to restore.
-
- 'CUT-AND-PASTE:
- 'One of the handiest features of the QB2 editor is the cut-and-paste feature.
- 'With NumLock off and the cursor on this line, hold down the Shift key and
- 'press the Up cursor. The two lines above will be highlighted. Press the Del
- 'key and the lines will disappear. Press the Ins key and they will return.
- 'You can highlight large blocks at a time using Shift and PgUp or PgDn. You
- 'can highlight a word by pressing Shift-Ctrl-Left/Right, or to the end of a
- 'line with Shift-End. After highlighting text, you can un-highlight it by
- 'pressing any cursor key but the Del key, or by pressing Esc. (PgDn)
- 'page 7 (Keyboard, continued)
-
- 'COPYING:
- 'In addition to moving text with the Del and Ins keys, you can copy it without
- 'deleting the original text. With the cursor here -->. press Shift-UpCursor.
- 'Now press F2 instead of Del. The text will remain highlighted until you press
- 'another key, then it will return to normal, but it is ready to be copied. (It
- 'would be less confusing if it returned to normal as soon as F2 is pressed,
- 'but don't let that distract you.) Put the cursor at the start of the next
- 'line and press the Ins key.
-
- 'DELETING WHOLE LINES:
- 'If you copied the lines per the instructions in the previous paragraph, you
- 'now have a couple of lines above that we don't want. To get rid of them,
- 'place the cursor on the line to be deleted and press Ctrl-Y. This non-
- 'mnemonic key combination is evidently a curious bow to WordStar - "curious"
- 'because nothing else about the editor resembles WordStar. Oh, well...
-
- 'You can also delete a line by just holding down the Del key until all the
- 'characters on the line are gone, at which point the line itself will go away.
- 'Again, you can restore a deleted line by pressing the Ins key. Only the last
- 'line deleted or the last block "cut" can be restored. (PgDn)
- 'page 8
- ' The Menu
- 'EDIT:
- 'All the cut, paste and copy functions we have been examining can be accessed
- 'by seleting "Edit" from the menu at the top of the screen. To do this, hold
- 'the Alt key and press E. A menu of options will pop down. All of the commands
- 'in the Edit menu can be invoked by pressing "shortcut" keys which we have
- 'been using up until now, such as the Del key to cut, F2 to copy, etc.
-
- 'FILE:
- 'In contrast to the Edit menu, none of the File menu options can be invoked by
- 'pressing shortcut keys. To get to the File menu, you must press Alt-F. You
- 'can then select an option by moving the cursor with the cursor keys and
- 'pressing Enter or by entering the first letter of the desired command and
- 'pressing Enter. If two commands in the same menu start with the same letter,
- 'press the letter twice. To get to the File menu, you must press Alt-F.
-
- 'Unlike the BASIC interpreter, QB2 will prompt you to save your file if you
- 'tell it to Load a new file, start a New file or Quit without saving your file
- 'It's the cumulative effect of QB2's many time-saving and work-saving features
- 'such as this one that makes QB2 so terrific.
- ' (PgDn)
- 'page 9 (The Menu, continued)
-
- 'VIEW:
- 'The Options function lets you do away with the menu bar and other such things
- 'on the screen. After a while, you should be able to live without most of the
- 'frills on the screen and enjoy being able to see three more lines of code per
- 'screen. The Options function also lets you change screen colors.
-
- 'The Errors option erases the Error message block that takes up a lot of the
- 'screen when your program hits a snag or if you even just do a Ctrl-Break. It
- 'is a little annoying to have to do an Alt-V, E, Enter to clear off the error
- 'message every time you Ctrl-Break out of a program, but it's nothing major.
-
- 'SEARCH:
- 'The Find function is very useful in quickly moving to subroutines, etc. The
- 'first option, "Find...", doesn't seem to do anything that the next function,
- '"Find selected text", doesn't do and the latter has two advantages. One is
- 'that if you have highlighted (selected) text on one line, it will be the text
- 'to be searched for. The other is that Ctrl-F is a hot key for Find Selected.
- 'and the regular Find has no hot key. Ctrl-F can also be used in place of
- 'Find Next (F3) if doing consecutive Find's.
- ' (PgDn)
- 'page 10 (The Menu, Search continued)
-
- 'Put the cursor here -> . and press Ctrl-F and type in 'and' as the word to
- 'search for. The word here- should be highlighted. Press Ctrl-F again and the
- 'next "and" will be highlighted. Remember that if text is highlighted and you
- 'start typing over it, the entire highlighted text will disappear at once, so
- 'be careful. To un-highlight the text, press ESC or a cursor-movement key.
-
- 'CHANGE:
- 'This is another major feature that interpretive BASIC does not have: a search
- 'and replace function. Change the name of a variable throughout your program
- 'with just a few keystrokes. Place the cursor here ->. and press Alt-S, C, and
- 'press Enter. For the word to be replace, type "and" (without the quotes) and
- 'press the TAB key (not Enter!) to get down to the next line and enter "&" to
- 'replace "and", then press Enter. The first "and" will be highlighted. Press
- 'the space bar. The change will be made and the next "and" will be highlighted.
- 'You can either TAB over to the "cancel" command and press space bar, or press
- 'ESC to abort the process. Press Alt-S, C and Enter to view the replace screen
- 'again so that you can see some of the other options. One option is to make
- 'all the replacements without verifying with you. Pretty dangerous. Another
- 'is to make the replace "case" or "whole-word" sensitive. Pretty handy.
- ' (PgDn)
- 'page 11 (The Menu, continued)
-
- 'RUN:
- 'We have seen that there are often several ways to do the same thing in QB2,
- 'just as there are in the BASIC language. The same is true when you want to
- 'Compile your code and Run it. You can press Alt-R, then C, Enter to compile
- 'your code and then press Ctrl-R to run it. Or you can just press Ctrl-R to
- 'start with and QB2 will automatically compile the code and run it when it is
- 'through. If you want to change some of the compile-time options, press Alt-R
- 'and C. Now you must press C again to get to the next option that starts with
- 'that letter, then press Enter. Go ahead and do that now. If you don't make it
- 'to the compile-time option screen, press ESC and try again: Alt-R, C, C, Ent.
-
- 'Use TAB | If you press Enter when the Compile screen comes | Use cursor
- '+ space | up, this program will compile. Go ahead and try | to change
- 'bar to | it. Then press Ctrl-R to run it. | options on
- 'select | | this side
- 'options | If you want to run the program again and haven't | and press
- 'on this | made any changes to the code, you can do so with- | TAB when
- 'side. | out re-compiling. Just press Ctrl-R again. | done.
-
- cls:locate 12,39:print "HI!":end '(PgDn)
- 'page 12 Review
-
- 'Cursor movement:
- 'Try out all the cursor movement keys one more time: the Up and Down arrows;
- 'Ctrl-Up and -Down to scroll the screen a line at a time; Ctrl-left and -right
- 'to move a word at a time; Home to move to the start of a line and End to the
- 'end of a line; Ctrl-Home to move to the top-left of the screen and Ctrl-End
- 'move to the bottom left of the screen. In my opinion, this is all more effi-
- 'cient than leaving the keyboard to use a mouse, so we have ignored the mouse
- 'in this tutorial. However, I have heard other people say they think it is
- 'wonderful and makes QB2 easier to use. If you are a mouse user, you should
- 'have no trouble figuring out how to use it with QB2.
-
- 'Shortcut keys:
- 'Ctrl-R to compile and run the program. Ctrl-F to find text.
- 'F2 to store highlighted text for copying. Del to delete highlighted text.
- 'Ins to copy F2'ed text or recall Deleted text. Shift-ESC to abort changes.
- 'F6 to see next error message. Alt-V,E to get rid of the error message box.
-
- 'If you are ready to move on to the next session, press Alt-F, L, Enter, and
- 'enter TUTOR-02.
- ' the end of lesson 1
-
-
-
-
- 'end of file - press PgUp
-